<?php
namespace app\admin\model;

use think\Model;

// 意见反馈

class Feedback extends Model
{
    /**
     * 获取列表
     */
    public function getList($pageNum, $numPerPage)
    {
        $numlist = (new self)->alias('feedback')->field('feedback.*, user_weixin.nick_name')->join('user_weixin user_weixin', 'user_weixin.id = feedback.user_weixin_id')->page($pageNum, $numPerPage)->order('feedback.create_time desc')->select();
        return $numlist;
    }

    // 获取总数
    public function getCount()
    {
        $count = (new self)->count();
        return $count;
    }

    public static function detail($id)
    {
        if(empty($id)){
            return '';
        }
        $thisModel = new Feedback();
        $info = $thisModel->alias('feedback')->field('feedback.*, user_weixin.nick_name')->join('user_weixin user_weixin','user_weixin.id = feedback.user_weixin_id','left')->where('feedback.id = '.$id)->fetchSql(false)->find()->toArray();
        $thisModel->where(['id'=>$id])->update(['look'=>2]);
        return $info;
    }

}